@zonos/elements 1.3.91 → 1.3.93

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (98) hide show
  1. package/dist/cjs/{CheckoutConfig-850071ae.js → CheckoutConfig-8e8a0d1c.js} +1 -1
  2. package/dist/cjs/{cart-3cc424f9.js → cart-9d0ced11.js} +27 -6
  3. package/dist/cjs/{createCustomEvent-68a5819f.js → createCustomEvent-f6317809.js} +2 -2
  4. package/dist/cjs/{handleFetch-45e76490.js → handleFetch-5a16f2bc.js} +1 -1
  5. package/dist/cjs/index.cjs.js +9 -9
  6. package/dist/cjs/{paypal-6abc29b9.js → paypal-a6ddcfaf.js} +2 -2
  7. package/dist/cjs/zonos-address_7.cjs.entry.js +2 -2
  8. package/dist/cjs/zonos-cart-items_12.cjs.entry.js +14 -11
  9. package/dist/cjs/zonos-checkout.cjs.entry.js +48 -38
  10. package/dist/cjs/zonos-controller.cjs.entry.js +2 -2
  11. package/dist/cjs/zonos-country-flag.cjs.entry.js +2 -2
  12. package/dist/cjs/zonos-country-select_4.cjs.entry.js +2 -2
  13. package/dist/cjs/zonos-hello-dialog.cjs.entry.js +2 -2
  14. package/dist/cjs/zonos-hello.cjs.entry.js +2 -2
  15. package/dist/cjs/zonos-language-select_2.cjs.entry.js +2 -2
  16. package/dist/cjs/zonos-notification_3.cjs.entry.js +3 -3
  17. package/dist/collection/components/checkout/zonos-checkout/zonos-checkout-finish/zonos-checkout-finish.js +10 -7
  18. package/dist/collection/components/checkout/zonos-checkout/zonos-checkout.js +45 -34
  19. package/dist/collection/components/store/checkout/cart.js +6 -1
  20. package/dist/collection/components/store/checkout/stripe.js +6 -2
  21. package/dist/collection/components/utils/hello/getZCountryUrlParam.js +14 -2
  22. package/dist/collection/components/utils/logging/log.js +1 -1
  23. package/dist/esm/{CheckoutConfig-c0ec120d.js → CheckoutConfig-c54d23b8.js} +1 -1
  24. package/dist/esm/{cart-66d67627.js → cart-ef2e2eec.js} +28 -7
  25. package/dist/esm/{createCustomEvent-34725327.js → createCustomEvent-73760da0.js} +2 -2
  26. package/dist/esm/{handleFetch-0133265e.js → handleFetch-ce924688.js} +1 -1
  27. package/dist/esm/index.js +10 -10
  28. package/dist/esm/{paypal-da9e020f.js → paypal-cce03d02.js} +2 -2
  29. package/dist/esm/zonos-address_7.entry.js +2 -2
  30. package/dist/esm/zonos-cart-items_12.entry.js +14 -11
  31. package/dist/esm/zonos-checkout.entry.js +48 -38
  32. package/dist/esm/zonos-controller.entry.js +2 -2
  33. package/dist/esm/zonos-country-flag.entry.js +2 -2
  34. package/dist/esm/zonos-country-select_4.entry.js +2 -2
  35. package/dist/esm/zonos-hello-dialog.entry.js +2 -2
  36. package/dist/esm/zonos-hello.entry.js +2 -2
  37. package/dist/esm/zonos-language-select_2.entry.js +2 -2
  38. package/dist/esm/zonos-notification_3.entry.js +3 -3
  39. package/dist/esm-es5/{CheckoutConfig-c0ec120d.js → CheckoutConfig-c54d23b8.js} +1 -1
  40. package/dist/esm-es5/{cart-66d67627.js → cart-ef2e2eec.js} +1 -1
  41. package/dist/esm-es5/createCustomEvent-73760da0.js +1 -0
  42. package/dist/esm-es5/index.js +1 -1
  43. package/dist/esm-es5/{paypal-da9e020f.js → paypal-cce03d02.js} +1 -1
  44. package/dist/esm-es5/zonos-address_7.entry.js +1 -1
  45. package/dist/esm-es5/zonos-cart-items_12.entry.js +1 -1
  46. package/dist/esm-es5/zonos-checkout.entry.js +1 -1
  47. package/dist/esm-es5/zonos-controller.entry.js +1 -1
  48. package/dist/esm-es5/zonos-country-flag.entry.js +1 -1
  49. package/dist/esm-es5/zonos-country-select_4.entry.js +1 -1
  50. package/dist/esm-es5/zonos-hello-dialog.entry.js +1 -1
  51. package/dist/esm-es5/zonos-hello.entry.js +1 -1
  52. package/dist/esm-es5/zonos-language-select_2.entry.js +1 -1
  53. package/dist/esm-es5/zonos-notification_3.entry.js +1 -1
  54. package/dist/scripts/index.js +1 -1
  55. package/dist/scripts/loadZonos.js +1 -1
  56. package/dist/scripts/zonos.js +1 -1
  57. package/dist/zonos-elements/index.esm.js +1 -1
  58. package/dist/zonos-elements/{p-0af823af.js → p-021c2035.js} +1 -1
  59. package/dist/zonos-elements/p-205d1fd0.system.entry.js +1 -0
  60. package/dist/zonos-elements/{p-fb85884a.entry.js → p-3242242f.entry.js} +1 -1
  61. package/dist/zonos-elements/{p-d3a8c7ae.system.js → p-332ccd38.system.js} +1 -1
  62. package/dist/zonos-elements/{p-1615c1c4.entry.js → p-36050826.entry.js} +1 -1
  63. package/dist/zonos-elements/{p-71cc7c12.system.entry.js → p-517444c0.system.entry.js} +1 -1
  64. package/dist/zonos-elements/p-52542b33.system.js +1 -0
  65. package/dist/zonos-elements/{p-324fd0ad.entry.js → p-52b7a342.entry.js} +1 -1
  66. package/dist/zonos-elements/{p-dd151786.entry.js → p-55534ab4.entry.js} +1 -1
  67. package/dist/zonos-elements/{p-2e00dbf9.entry.js → p-6037f297.entry.js} +1 -1
  68. package/dist/zonos-elements/{p-d1c0bc88.system.js → p-606e0443.system.js} +1 -1
  69. package/dist/zonos-elements/p-609209fe.entry.js +1 -0
  70. package/dist/zonos-elements/{p-6e49e7cc.system.entry.js → p-61c43b0c.system.entry.js} +1 -1
  71. package/dist/zonos-elements/{p-5cbae38e.js → p-7141699d.js} +1 -1
  72. package/dist/zonos-elements/{p-14d2312c.system.entry.js → p-832535b5.system.entry.js} +1 -1
  73. package/dist/zonos-elements/{p-b8e85bf5.js → p-9a13b43f.js} +1 -1
  74. package/dist/zonos-elements/{p-14783646.entry.js → p-a8fb9ec4.entry.js} +1 -1
  75. package/dist/zonos-elements/{p-eca9ebc4.system.entry.js → p-a92ea268.system.entry.js} +1 -1
  76. package/dist/zonos-elements/{p-35d1a532.system.js → p-acb212b2.system.js} +1 -1
  77. package/dist/zonos-elements/{p-c61d62ec.js → p-ad8b87ec.js} +1 -1
  78. package/dist/zonos-elements/{p-b85f701c.entry.js → p-c6950e78.entry.js} +1 -1
  79. package/dist/zonos-elements/{p-03159bbf.system.entry.js → p-c6f848d6.system.entry.js} +1 -1
  80. package/dist/zonos-elements/p-c78dd680.system.js +1 -1
  81. package/dist/zonos-elements/{p-06bab7d2.entry.js → p-c990f553.entry.js} +1 -1
  82. package/dist/zonos-elements/{p-a637cb1c.system.entry.js → p-d42d729b.system.entry.js} +1 -1
  83. package/dist/zonos-elements/{p-072f4a48.system.entry.js → p-d8c3540c.system.entry.js} +1 -1
  84. package/dist/zonos-elements/{p-6525fa0e.system.entry.js → p-dbc57aea.system.entry.js} +1 -1
  85. package/dist/zonos-elements/p-e11d7951.system.entry.js +1 -0
  86. package/dist/zonos-elements/p-e2bbd294.entry.js +1 -0
  87. package/dist/zonos-elements/{p-e987ae90.system.js → p-e3432dca.system.js} +1 -1
  88. package/dist/zonos-elements/zonos-elements.esm.js +1 -1
  89. package/package.json +1 -1
  90. package/dist/esm-es5/createCustomEvent-34725327.js +0 -1
  91. package/dist/zonos-elements/p-0deebb7a.entry.js +0 -1
  92. package/dist/zonos-elements/p-6c6eb676.entry.js +0 -1
  93. package/dist/zonos-elements/p-8c0ff373.system.js +0 -1
  94. package/dist/zonos-elements/p-bd1b32ea.system.entry.js +0 -1
  95. package/dist/zonos-elements/p-c0e66eb4.system.entry.js +0 -1
  96. /package/dist/esm-es5/{handleFetch-0133265e.js → handleFetch-ce924688.js} +0 -0
  97. /package/dist/zonos-elements/{p-197c5707.system.js → p-480556ea.system.js} +0 -0
  98. /package/dist/zonos-elements/{p-ad7ce197.js → p-539cc913.js} +0 -0
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- const handleFetch = require('./handleFetch-45e76490.js');
3
+ const handleFetch = require('./handleFetch-5a16f2bc.js');
4
4
 
5
5
  const getTempCartById = async (cartId) => {
6
6
  const { errors, json } = await handleFetch.handleFetch('/api/zonos-elements/get-temp-cart', {
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  const zonosStore = require('./zonosStore-a4395972.js');
4
- const handleFetch = require('./handleFetch-45e76490.js');
4
+ const handleFetch = require('./handleFetch-5a16f2bc.js');
5
5
  const isDarkColor = require('./isDarkColor-5efc8367.js');
6
6
  const getBorderRadius = require('./getBorderRadius-5a64574c.js');
7
7
 
@@ -8111,11 +8111,23 @@ const getLocaleMessages = async ({ countryCode, localeTo, storeId, }) => {
8111
8111
  return json.locale_countryCodesPage;
8112
8112
  };
8113
8113
 
8114
+ const validateCountryCode = (countryCode) => {
8115
+ // Check that the country is two characters and is upper case
8116
+ if (countryCode && /^[A-Z]{2}$/.test(countryCode)) {
8117
+ return countryCode;
8118
+ }
8119
+ return null;
8120
+ };
8114
8121
  const getZCountryUrlParam = (urlParams) => {
8115
8122
  const urlSearchParams = new URLSearchParams(urlParams || window.location.search);
8116
- const zCountry = urlSearchParams.get('zCountry');
8123
+ const getCountryParam = (param) => {
8124
+ const country = urlSearchParams.get(param);
8125
+ // Check that the country is two characters and is upper case
8126
+ return validateCountryCode(country);
8127
+ };
8128
+ const zCountry = getCountryParam('zCountry');
8117
8129
  // Fallback to legacy 'country'
8118
- const fallback = urlSearchParams.get('country');
8130
+ const fallback = getCountryParam('country');
8119
8131
  return zCountry || fallback;
8120
8132
  };
8121
8133
 
@@ -9474,8 +9486,12 @@ const stripeStoreConfirmPayment = async () => {
9474
9486
  const stripeStoreInitCheckoutSession = async () => {
9475
9487
  var _a, _b;
9476
9488
  const total = cartStore.items.reduce((amount, item) => amount + item.amount * item.quantity, 0);
9477
- if (!total || !localizationStore.targetCurrency) {
9478
- handleFetch.logError('Failed to create checkout session - invalid total or currency');
9489
+ if (!localizationStore.targetCurrency) {
9490
+ handleFetch.logError(`Failed to create checkout session - missing localizationStore.targetCurrency`);
9491
+ return false;
9492
+ }
9493
+ if (!total) {
9494
+ handleFetch.logError(`Failed to create checkout session - missing total amount of items`);
9479
9495
  return false;
9480
9496
  }
9481
9497
  stripeStore.isFetchingSession = true;
@@ -9853,13 +9869,18 @@ const cartStoreReCalculateTotal = async ({ adjustmentsAmount, cartId, currency,
9853
9869
  presentmentCountryCode: localizationStore.selectedCountryCode,
9854
9870
  });
9855
9871
  if (errors.length > 0 || !json) {
9856
- // do nothing if we can't get checkout session
9857
9872
  handleFetch.logError('Error occurs when updating checkout session.');
9858
9873
  if (shouldInitSessionOnFailure) {
9859
9874
  handleFetch.log('Initiating checkout session on failure', 'info');
9860
9875
  const success = await stripeStoreInitCheckoutSession();
9861
9876
  handleFetch.log(`stripeStoreInitCheckoutSession: ${success}`);
9862
9877
  if (!success) {
9878
+ cartStoreUpdateToErrorState({
9879
+ messages: [
9880
+ translate("There's been an error creating your checkout session. Please reload and try again or contact support if the error persists"),
9881
+ ],
9882
+ title: translate('Error creating Checkout'),
9883
+ });
9863
9884
  return false;
9864
9885
  }
9865
9886
  return true;
@@ -1,8 +1,8 @@
1
1
  'use strict';
2
2
 
3
- const cart = require('./cart-3cc424f9.js');
3
+ const cart = require('./cart-9d0ced11.js');
4
4
  const zonosStore = require('./zonosStore-a4395972.js');
5
- const handleFetch = require('./handleFetch-45e76490.js');
5
+ const handleFetch = require('./handleFetch-5a16f2bc.js');
6
6
 
7
7
  const trackConversionEvent = async (eventName, metadata) => {
8
8
  var _a, _b;
@@ -55,7 +55,7 @@ const log = (message, type, ..._additionalInfo) => {
55
55
  loggingIframe.style.visibility = 'hidden';
56
56
  document.body.appendChild(loggingIframe);
57
57
  }
58
- // use the logging iframe's console to log just in case the console is disabled (overriden) by the site owner
58
+ // use the logging iframe's console to log just in case the console is disabled (overridden) by the site owner
59
59
  const zConsole = ((_b = loggingIframe.contentWindow) === null || _b === void 0 ? void 0 : _b.window.console) || window.console;
60
60
  switch (type) {
61
61
  case 'warn':
@@ -2,8 +2,8 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const handleFetch = require('./handleFetch-45e76490.js');
6
- const CheckoutConfig = require('./CheckoutConfig-850071ae.js');
5
+ const handleFetch = require('./handleFetch-5a16f2bc.js');
6
+ const CheckoutConfig = require('./CheckoutConfig-8e8a0d1c.js');
7
7
 
8
8
  /**
9
9
  * Get the load version and url based on the loadScriptSrc and version
@@ -97,7 +97,7 @@ const getZonosQaUrl = () => {
97
97
  return null;
98
98
  }
99
99
  const qaUrl = extractZonosQaUrl(window.location.href);
100
- const cdnUrl = "https://v1.3.91.js.zonos.com";
100
+ const cdnUrl = "https://v1.3.93.js.zonos.com";
101
101
  // when the qaUrl is not set and the built URL is from the test domain, use the test domain for testing
102
102
  if (!qaUrl &&
103
103
  (cdnUrl.includes('test.') ||
@@ -281,10 +281,10 @@ const zonosLoadUrl = (() => {
281
281
  }
282
282
  return null;
283
283
  })();
284
- const ZONOS_URL = "https://v1.3.91.js.zonos.com";
285
- const JS_DELIVR_ZONOS_URL = zonosLoadUrl || "https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.91";
286
- const UNPKG_ZONOS_URL = "https://unpkg.com/@zonos/elements@1.3.91";
287
- const CDNJS_ZONOS_URL = "https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.91";
284
+ const ZONOS_URL = "https://v1.3.93.js.zonos.com";
285
+ const JS_DELIVR_ZONOS_URL = zonosLoadUrl || "https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.93";
286
+ const UNPKG_ZONOS_URL = "https://unpkg.com/@zonos/elements@1.3.93";
287
+ const CDNJS_ZONOS_URL = "https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.93";
288
288
  const INTER_FONT_URL = 'https://rsms.me';
289
289
  const GOOGLE_FONT_URL = 'https://fonts.googleapis.com';
290
290
  const INTER_FONT_REGEX = /^https:\/\/rsms\.me\/inter\/inter\.css(.*)$/;
@@ -299,7 +299,7 @@ Zonos.zonosConversionTest = typeof window !== 'undefined' &&
299
299
  !!window.location.search.match(/\?.*(&*)zonosConversionTest/);
300
300
  Zonos._paypalMockResponse = null;
301
301
  Zonos.isBigCommerce = false;
302
- Zonos.releaseDate = "1728930718892";
302
+ Zonos.releaseDate = "1729003957102";
303
303
  Zonos.isLegacyCheckout = false;
304
304
  /**
305
305
  * By default, the package will load from npm
@@ -307,7 +307,7 @@ Zonos.isLegacyCheckout = false;
307
307
  Zonos.isNpm = true;
308
308
  Zonos.zonosQaUrl = null;
309
309
  Zonos.zonosQaUrlApi = null;
310
- Zonos.version = `v${"1.3.91"}`;
310
+ Zonos.version = `v${"1.3.93"}`;
311
311
  Zonos.modeAlerted = false;
312
312
  Zonos.cartData = null;
313
313
  Zonos.paypal = null;
@@ -1,8 +1,8 @@
1
1
  'use strict';
2
2
 
3
3
  const zonosStore = require('./zonosStore-a4395972.js');
4
- const cart = require('./cart-3cc424f9.js');
5
- const handleFetch = require('./handleFetch-45e76490.js');
4
+ const cart = require('./cart-9d0ced11.js');
5
+ const handleFetch = require('./handleFetch-5a16f2bc.js');
6
6
  const isDarkColor = require('./isDarkColor-5efc8367.js');
7
7
 
8
8
  /*!
@@ -3,9 +3,9 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const index = require('./index-d56e0a8b.js');
6
- const cart = require('./cart-3cc424f9.js');
6
+ const cart = require('./cart-9d0ced11.js');
7
7
  const isCheckoutMobile = require('./isCheckoutMobile-f491ca7c.js');
8
- const handleFetch = require('./handleFetch-45e76490.js');
8
+ const handleFetch = require('./handleFetch-5a16f2bc.js');
9
9
  const containsNonLatinChars = require('./containsNonLatinChars-2be5129b.js');
10
10
  const zonosStore = require('./zonosStore-a4395972.js');
11
11
  const classes = require('./classes-b7918f56.js');
@@ -3,13 +3,13 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const index = require('./index-d56e0a8b.js');
6
- const cart = require('./cart-3cc424f9.js');
6
+ const cart = require('./cart-9d0ced11.js');
7
7
  const classes = require('./classes-b7918f56.js');
8
- const paypal = require('./paypal-6abc29b9.js');
8
+ const paypal = require('./paypal-a6ddcfaf.js');
9
9
  const zonosStore = require('./zonosStore-a4395972.js');
10
- const createCustomEvent = require('./createCustomEvent-68a5819f.js');
10
+ const createCustomEvent = require('./createCustomEvent-f6317809.js');
11
11
  const getBorderRadius = require('./getBorderRadius-5a64574c.js');
12
- const handleFetch = require('./handleFetch-45e76490.js');
12
+ const handleFetch = require('./handleFetch-5a16f2bc.js');
13
13
  const isCheckoutMobile = require('./isCheckoutMobile-f491ca7c.js');
14
14
  const ILanguage = require('./ILanguage-98b04442.js');
15
15
  const isDarkColor = require('./isDarkColor-5efc8367.js');
@@ -1290,10 +1290,13 @@ const ZonosCheckoutFinish = class {
1290
1290
  this.getPullOrder = async (attempts = 0) => {
1291
1291
  var _a, _b;
1292
1292
  const { baseUrl, order } = await this.pullOrder();
1293
- const legacyOrderNumberExist = !!((_b = (_a = order === null || order === void 0 ? void 0 : order.references) === null || _a === void 0 ? void 0 : _a.find(entry => (entry === null || entry === void 0 ? void 0 : entry.key) === 'zonosOrderNumber')) === null || _b === void 0 ? void 0 : _b.value);
1294
- // legacy customers are still using the old order number so we need to wait for legacy order number to attach to dgs order before redirecting
1295
- if ((order && attempts >= 5) || legacyOrderNumberExist) {
1296
- if (!legacyOrderNumberExist) {
1293
+ const { isLegacyCheckout } = window.Zonos;
1294
+ const foundLegacyOrderNumber = !!((_b = (_a = order === null || order === void 0 ? void 0 : order.references) === null || _a === void 0 ? void 0 : _a.find(entry => (entry === null || entry === void 0 ? void 0 : entry.key) === 'zonosOrderNumber')) === null || _b === void 0 ? void 0 : _b.value);
1295
+ if ((order && !isLegacyCheckout) ||
1296
+ (!order && attempts >= 5) ||
1297
+ foundLegacyOrderNumber) {
1298
+ if (isLegacyCheckout && !foundLegacyOrderNumber) {
1299
+ // We pushed this one through without the legacy order number, so we should log this
1297
1300
  const checkoutSessionId = cart.cartStore.checkoutSessionId;
1298
1301
  void handleFetch.sendErrorLog({
1299
1302
  endpoint: `${baseUrl}/api/zonos-elements/get-order?checkoutSessionId=${checkoutSessionId}&orderId=${order === null || order === void 0 ? void 0 : order.id}`,
@@ -1310,7 +1313,7 @@ const ZonosCheckoutFinish = class {
1310
1313
  this.order = order;
1311
1314
  this.handleSuccessBehavior();
1312
1315
  }
1313
- else if ((!order || !legacyOrderNumberExist) && attempts < 5) {
1316
+ else if ((!order || !foundLegacyOrderNumber) && attempts < 5) {
1314
1317
  // Wait for 1 second before the next attempt
1315
1318
  await new Promise(resolve => setTimeout(resolve, 1000));
1316
1319
  await this.getPullOrder(attempts + 1);
@@ -1446,11 +1449,11 @@ const ZonosCheckoutFinish = class {
1446
1449
  var _a, _b;
1447
1450
  const orderId = ((_a = this.order) === null || _a === void 0 ? void 0 : _a.accountOrderNumber) || getGraphQlShortId((_b = this.order) === null || _b === void 0 ? void 0 : _b.id);
1448
1451
  const isTestMode = createCustomEvent.getIsTestMode();
1449
- return (index.h(index.Host, { key: 'b39124e58c4b12acbd7b29290808248298239e9c', class: "zonos--checkout-finish zonos--elements", style: {
1452
+ return (index.h(index.Host, { key: '87ced5680c0d1bab551332541d74e8e32fd7ed43', class: "zonos--checkout-finish zonos--elements", style: {
1450
1453
  '--border-radius': getBorderRadius.getBorderRadius({
1451
1454
  overrideBorderStyle: this.borderRadius,
1452
1455
  }),
1453
- } }, this.isLoading && (index.h("div", { key: 'e63389c86a1bb0c405e7ae3c852fc1c966320f50', class: "loading-wrapper" }, index.h("zonos-spinner", { key: '0caff7b42ab138ad47f4683ea9641b2fef75f714' }))), !this.isLoading && (index.h("div", { key: 'e305f1c720418a22a376807f17413fa97688af86', class: "zonos--finish-details" }, index.h("div", { key: 'dced8dc9e0a7ae68e4bfa6b00d841ba4eae9e1f3', class: "zonos--group" }, this.notificationType === 'success' ? (index.h("zonos-icon", { "aria-label": "Order success", content: SuccessIcon, iconColor: 'blue-800', size: 50 })) : (index.h("zonos-icon", { "aria-label": "Order failed", content: RemoveIcon, iconColor: 'red-800', size: 50 })), index.h("zonos-text", { key: '343dade4f02efe9c9fdc4c8087b725f2d4e39177', class: "zonos--title", type: "semiBoldSubheader" }, this.notificationTitle), orderId && (index.h("div", { key: 'aa715a39e3126d7cb108c447fb2eb586279fc768', class: "zonos--order-number" }, "Order #", orderId)), index.h("zonos-text", { key: 'ee58b57b784269145d286e59cc87eb4fb5499cf2', textColor: "gray-600" }, this.notificationMessages.map(message => (index.h(index.Fragment, null, message, index.h("br", null))))), index.h("zonos-button", { key: 'a6781fde72abf7b9939e136aa5fdbbdd513a7cf5', onClick: () => this.closeClickHandler(), size: "md", variant: "primary" }, this.notificationActionText)), isTestMode && cart.cartStore.step === 'finish' && (index.h("div", { key: '5fd0ea2aa8f48347d027c5c7df1eb892236e7bb0', class: "zonos--finish-button-wrapper" }, index.h("zonos-button", { key: '7fdfb2af11a60f4b20b3ba083dcca1f0ac90ff56', backgroundColor: "gray-0", buttonColor: "gray-1200", onClick: () => this.closeClickHandler(), size: "lg", variant: "outline" }, "New test cart"), index.h("zonos-button", { key: 'd627533d236a8d9cdaadce90d550984e25b64554', onClick: () => this.redirectToUrl(`/orders/all`), size: "lg", variant: "primary" }, "View order in Dashboard")))))));
1456
+ } }, this.isLoading && (index.h("div", { key: '8063a0e619af1958afc99e4a9aa8bdfeb3f3f896', class: "loading-wrapper" }, index.h("zonos-spinner", { key: '28d4219090e3c9cb0c8a48fa369ace28f74aa938' }))), !this.isLoading && (index.h("div", { key: '094b79103e3a26e57c0d81a1153682649dce693e', class: "zonos--finish-details" }, index.h("div", { key: 'c3a6fe214d5ac5cd58ec533c75e146e573b5da25', class: "zonos--group" }, this.notificationType === 'success' ? (index.h("zonos-icon", { "aria-label": "Order success", content: SuccessIcon, iconColor: 'blue-800', size: 50 })) : (index.h("zonos-icon", { "aria-label": "Order failed", content: RemoveIcon, iconColor: 'red-800', size: 50 })), index.h("zonos-text", { key: 'c9e1b5c7ed5be8b6adbd00e5b3896e023271976e', class: "zonos--title", type: "semiBoldSubheader" }, this.notificationTitle), orderId && (index.h("div", { key: '8f32ef78f8e584e43988a12bc94f0d52c0348eba', class: "zonos--order-number" }, "Order #", orderId)), index.h("zonos-text", { key: 'b9aebf9fdfc17d141367deb110440272fed7a6d9', textColor: "gray-600" }, this.notificationMessages.map(message => (index.h(index.Fragment, null, message, index.h("br", null))))), index.h("zonos-button", { key: '25fb15e1e2fb08e2911c787060215f8e1d7c33c6', onClick: () => this.closeClickHandler(), size: "md", variant: "primary" }, this.notificationActionText)), isTestMode && cart.cartStore.step === 'finish' && (index.h("div", { key: 'd39ae7b5a0889278e0f6a3594ad69dfa0de2159a', class: "zonos--finish-button-wrapper" }, index.h("zonos-button", { key: '09e0dfa830577c1eec035f34342528a73bffe944', backgroundColor: "gray-0", buttonColor: "gray-1200", onClick: () => this.closeClickHandler(), size: "lg", variant: "outline" }, "New test cart"), index.h("zonos-button", { key: 'eedb6a440713fe5f14a05a747284a2703af1a639', onClick: () => this.redirectToUrl(`/orders/all`), size: "lg", variant: "primary" }, "View order in Dashboard")))))));
1454
1457
  }
1455
1458
  static get assetsDirs() { return ["assets"]; }
1456
1459
  };
@@ -3,16 +3,16 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const index = require('./index-d56e0a8b.js');
6
- const cart = require('./cart-3cc424f9.js');
7
- const paypal = require('./paypal-6abc29b9.js');
6
+ const cart = require('./cart-9d0ced11.js');
7
+ const paypal = require('./paypal-a6ddcfaf.js');
8
8
  const zonosStore = require('./zonosStore-a4395972.js');
9
- const createCustomEvent = require('./createCustomEvent-68a5819f.js');
9
+ const createCustomEvent = require('./createCustomEvent-f6317809.js');
10
10
  const isCheckoutMobile = require('./isCheckoutMobile-f491ca7c.js');
11
- const handleFetch = require('./handleFetch-45e76490.js');
11
+ const handleFetch = require('./handleFetch-5a16f2bc.js');
12
12
  const classes = require('./classes-b7918f56.js');
13
13
  const getBorderRadius = require('./getBorderRadius-5a64574c.js');
14
14
  const isDarkColor = require('./isDarkColor-5efc8367.js');
15
- const CheckoutConfig = require('./CheckoutConfig-850071ae.js');
15
+ const CheckoutConfig = require('./CheckoutConfig-8e8a0d1c.js');
16
16
  const RemoveIcon = require('./RemoveIcon-081ac073.js');
17
17
 
18
18
  /**
@@ -380,12 +380,6 @@ const ZonosCheckout = class {
380
380
  catch (err) {
381
381
  // stop loading
382
382
  cart.stripeStore.isFetchingSession = false;
383
- cart.cartStoreUpdateToErrorState({
384
- messages: [
385
- cart.translate("There's been an error creating your checkout session. Please reload and try again or contact support if the error persists"),
386
- ],
387
- title: cart.translate('Error creating Checkout'),
388
- });
389
383
  // We want to log the error anytime we fail to create a checkout session
390
384
  void handleFetch.sendErrorLog({
391
385
  endpoint: 'Error creating Checkout',
@@ -397,6 +391,12 @@ const ZonosCheckout = class {
397
391
  storeBaseUrl: (_a = window.Zonos.cartData) === null || _a === void 0 ? void 0 : _a.storeBaseUrl,
398
392
  },
399
393
  });
394
+ cart.cartStoreUpdateToErrorState({
395
+ messages: [
396
+ cart.translate("There's been an error creating your checkout session. Please reload and try again or contact support if the error persists"),
397
+ ],
398
+ title: cart.translate('Error creating Checkout'),
399
+ });
400
400
  }
401
401
  }, {
402
402
  // Trigger this event before any other event
@@ -435,40 +435,50 @@ const ZonosCheckout = class {
435
435
  */
436
436
  useLegacyQueryParams() {
437
437
  const urlParams = new URLSearchParams(window.location.search);
438
- const legacyShippingInfo = {
439
- country:
440
- // fallback to selected country code if country is not provided
441
- urlParams.get('country') || cart.localizationStore.selectedCountryCode,
442
- customerAddress1: urlParams.get('customerAddress1'),
443
- customerAddress2: urlParams.get('customerAddress2'),
444
- customerCity: urlParams.get('customerCity'),
445
- customerEmail: urlParams.get('customerEmail'),
446
- customerName: urlParams.get('customerName'),
447
- customerPhone: urlParams.get('customerPhone'),
448
- customerState: urlParams.get('customerState'),
449
- customerZip: urlParams.get('customerZip'),
438
+ handleFetch.log('legacy urlParams', 'info', Object.fromEntries(urlParams.entries()));
439
+ const getParam = (param) => {
440
+ const value = urlParams.get(param);
441
+ if (!value || value === 'undefined') {
442
+ return null;
443
+ }
444
+ return value;
450
445
  };
446
+ const country =
447
+ // fallback to selected country code if country is not provided
448
+ cart.getZCountryUrlParam(urlParams) || cart.localizationStore.selectedCountryCode;
449
+ const city = getParam('customerCity');
450
+ const email = getParam('customerEmail') || '';
451
+ const line1 = getParam('customerAddress1');
452
+ const line2 = getParam('customerAddress2') || '';
453
+ const name = getParam('customerName');
454
+ const phone = getParam('customerPhone');
455
+ const postal_code = getParam('customerZip') || '';
456
+ const state = getParam('customerState') || '';
451
457
  // if one of the value is null, no need to preset the default address
452
- if (!legacyShippingInfo.customerAddress1 ||
453
- !legacyShippingInfo.customerCity ||
454
- !legacyShippingInfo.customerName ||
455
- !legacyShippingInfo.customerPhone ||
456
- !legacyShippingInfo.country) {
457
- handleFetch.log('Missing some query params so it can not be prefilled', 'info', legacyShippingInfo);
458
+ if (!line1 || !city || !name || !phone || !country) {
459
+ handleFetch.log('Missing required query params so it can not be prefilled', 'info', [
460
+ !line1 && 'line1',
461
+ !city && 'city',
462
+ !name && 'name',
463
+ !phone && 'phone',
464
+ !country && 'country',
465
+ ]
466
+ .filter(Boolean)
467
+ .join(', '));
458
468
  return;
459
469
  }
460
470
  this.defaultAddress = {
461
471
  address: {
462
- city: legacyShippingInfo.customerCity,
463
- country: legacyShippingInfo.country,
464
- line1: legacyShippingInfo.customerAddress1,
465
- line2: legacyShippingInfo.customerAddress2 || '',
466
- postal_code: legacyShippingInfo.customerZip || '',
467
- state: legacyShippingInfo.customerState || '',
472
+ city,
473
+ country,
474
+ line1,
475
+ line2,
476
+ postal_code,
477
+ state,
468
478
  },
469
- email: legacyShippingInfo.customerEmail || '',
470
- name: legacyShippingInfo.customerName,
471
- phone: legacyShippingInfo.customerPhone,
479
+ email,
480
+ name,
481
+ phone,
472
482
  };
473
483
  }
474
484
  /**
@@ -3,9 +3,9 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const index = require('./index-d56e0a8b.js');
6
- const cart = require('./cart-3cc424f9.js');
6
+ const cart = require('./cart-9d0ced11.js');
7
7
  const zonosStore = require('./zonosStore-a4395972.js');
8
- const handleFetch = require('./handleFetch-45e76490.js');
8
+ const handleFetch = require('./handleFetch-5a16f2bc.js');
9
9
  require('./isDarkColor-5efc8367.js');
10
10
  require('./getBorderRadius-5a64574c.js');
11
11
 
@@ -3,10 +3,10 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const index = require('./index-d56e0a8b.js');
6
- const cart = require('./cart-3cc424f9.js');
6
+ const cart = require('./cart-9d0ced11.js');
7
7
  const zonosStore = require('./zonosStore-a4395972.js');
8
8
  const classes = require('./classes-b7918f56.js');
9
- require('./handleFetch-45e76490.js');
9
+ require('./handleFetch-5a16f2bc.js');
10
10
  require('./isDarkColor-5efc8367.js');
11
11
  require('./getBorderRadius-5a64574c.js');
12
12
 
@@ -3,12 +3,12 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const index = require('./index-d56e0a8b.js');
6
- const cart = require('./cart-3cc424f9.js');
6
+ const cart = require('./cart-9d0ced11.js');
7
7
  const zonosStore = require('./zonosStore-a4395972.js');
8
8
  const formatStringWithLinks = require('./formatStringWithLinks-52341fc7.js');
9
9
  const isDarkColor = require('./isDarkColor-5efc8367.js');
10
10
  const ILanguage = require('./ILanguage-98b04442.js');
11
- require('./handleFetch-45e76490.js');
11
+ require('./handleFetch-5a16f2bc.js');
12
12
  require('./getBorderRadius-5a64574c.js');
13
13
 
14
14
  /**
@@ -3,12 +3,12 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const index = require('./index-d56e0a8b.js');
6
- const cart = require('./cart-3cc424f9.js');
6
+ const cart = require('./cart-9d0ced11.js');
7
7
  const zonosStore = require('./zonosStore-a4395972.js');
8
8
  const classes = require('./classes-b7918f56.js');
9
9
  const formatStringWithLinks = require('./formatStringWithLinks-52341fc7.js');
10
10
  const getHasMoreSpaceOnRight = require('./getHasMoreSpaceOnRight-4c94667f.js');
11
- require('./handleFetch-45e76490.js');
11
+ require('./handleFetch-5a16f2bc.js');
12
12
  require('./isDarkColor-5efc8367.js');
13
13
  require('./getBorderRadius-5a64574c.js');
14
14
 
@@ -4,9 +4,9 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const index = require('./index-d56e0a8b.js');
6
6
  const zonosStore = require('./zonosStore-a4395972.js');
7
- const cart = require('./cart-3cc424f9.js');
7
+ const cart = require('./cart-9d0ced11.js');
8
8
  const classes = require('./classes-b7918f56.js');
9
- const handleFetch = require('./handleFetch-45e76490.js');
9
+ const handleFetch = require('./handleFetch-5a16f2bc.js');
10
10
  const getHasMoreSpaceOnRight = require('./getHasMoreSpaceOnRight-4c94667f.js');
11
11
  require('./isDarkColor-5efc8367.js');
12
12
  require('./getBorderRadius-5a64574c.js');
@@ -3,10 +3,10 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const index = require('./index-d56e0a8b.js');
6
- const cart = require('./cart-3cc424f9.js');
6
+ const cart = require('./cart-9d0ced11.js');
7
7
  const zonosStore = require('./zonosStore-a4395972.js');
8
8
  const ILanguage = require('./ILanguage-98b04442.js');
9
- require('./handleFetch-45e76490.js');
9
+ require('./handleFetch-5a16f2bc.js');
10
10
  require('./isDarkColor-5efc8367.js');
11
11
  require('./getBorderRadius-5a64574c.js');
12
12
 
@@ -5,9 +5,9 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  const index = require('./index-d56e0a8b.js');
6
6
  const zonosStore = require('./zonosStore-a4395972.js');
7
7
  const classes = require('./classes-b7918f56.js');
8
- const cart = require('./cart-3cc424f9.js');
9
- const handleFetch = require('./handleFetch-45e76490.js');
10
- const paypal = require('./paypal-6abc29b9.js');
8
+ const cart = require('./cart-9d0ced11.js');
9
+ const handleFetch = require('./handleFetch-5a16f2bc.js');
10
+ const paypal = require('./paypal-a6ddcfaf.js');
11
11
  require('./isDarkColor-5efc8367.js');
12
12
  require('./getBorderRadius-5a64574c.js');
13
13
 
@@ -95,10 +95,13 @@ export class ZonosCheckoutFinish {
95
95
  this.getPullOrder = async (attempts = 0) => {
96
96
  var _a, _b;
97
97
  const { baseUrl, order } = await this.pullOrder();
98
- const legacyOrderNumberExist = !!((_b = (_a = order === null || order === void 0 ? void 0 : order.references) === null || _a === void 0 ? void 0 : _a.find(entry => (entry === null || entry === void 0 ? void 0 : entry.key) === 'zonosOrderNumber')) === null || _b === void 0 ? void 0 : _b.value);
99
- // legacy customers are still using the old order number so we need to wait for legacy order number to attach to dgs order before redirecting
100
- if ((order && attempts >= 5) || legacyOrderNumberExist) {
101
- if (!legacyOrderNumberExist) {
98
+ const { isLegacyCheckout } = window.Zonos;
99
+ const foundLegacyOrderNumber = !!((_b = (_a = order === null || order === void 0 ? void 0 : order.references) === null || _a === void 0 ? void 0 : _a.find(entry => (entry === null || entry === void 0 ? void 0 : entry.key) === 'zonosOrderNumber')) === null || _b === void 0 ? void 0 : _b.value);
100
+ if ((order && !isLegacyCheckout) ||
101
+ (!order && attempts >= 5) ||
102
+ foundLegacyOrderNumber) {
103
+ if (isLegacyCheckout && !foundLegacyOrderNumber) {
104
+ // We pushed this one through without the legacy order number, so we should log this
102
105
  const checkoutSessionId = cartStore.checkoutSessionId;
103
106
  void sendErrorLog({
104
107
  endpoint: `${baseUrl}/api/zonos-elements/get-order?checkoutSessionId=${checkoutSessionId}&orderId=${order === null || order === void 0 ? void 0 : order.id}`,
@@ -115,7 +118,7 @@ export class ZonosCheckoutFinish {
115
118
  this.order = order;
116
119
  this.handleSuccessBehavior();
117
120
  }
118
- else if ((!order || !legacyOrderNumberExist) && attempts < 5) {
121
+ else if ((!order || !foundLegacyOrderNumber) && attempts < 5) {
119
122
  // Wait for 1 second before the next attempt
120
123
  await new Promise(resolve => setTimeout(resolve, 1000));
121
124
  await this.getPullOrder(attempts + 1);
@@ -251,11 +254,11 @@ export class ZonosCheckoutFinish {
251
254
  var _a, _b;
252
255
  const orderId = ((_a = this.order) === null || _a === void 0 ? void 0 : _a.accountOrderNumber) || getGraphQlShortId((_b = this.order) === null || _b === void 0 ? void 0 : _b.id);
253
256
  const isTestMode = getIsTestMode();
254
- return (h(Host, { key: 'b39124e58c4b12acbd7b29290808248298239e9c', class: "zonos--checkout-finish zonos--elements", style: {
257
+ return (h(Host, { key: '87ced5680c0d1bab551332541d74e8e32fd7ed43', class: "zonos--checkout-finish zonos--elements", style: {
255
258
  '--border-radius': getBorderRadius({
256
259
  overrideBorderStyle: this.borderRadius,
257
260
  }),
258
- } }, this.isLoading && (h("div", { key: 'e63389c86a1bb0c405e7ae3c852fc1c966320f50', class: "loading-wrapper" }, h("zonos-spinner", { key: '0caff7b42ab138ad47f4683ea9641b2fef75f714' }))), !this.isLoading && (h("div", { key: 'e305f1c720418a22a376807f17413fa97688af86', class: "zonos--finish-details" }, h("div", { key: 'dced8dc9e0a7ae68e4bfa6b00d841ba4eae9e1f3', class: "zonos--group" }, this.notificationType === 'success' ? (h("zonos-icon", { "aria-label": "Order success", content: SuccessIcon, iconColor: 'blue-800', size: 50 })) : (h("zonos-icon", { "aria-label": "Order failed", content: RemoveIcon, iconColor: 'red-800', size: 50 })), h("zonos-text", { key: '343dade4f02efe9c9fdc4c8087b725f2d4e39177', class: "zonos--title", type: "semiBoldSubheader" }, this.notificationTitle), orderId && (h("div", { key: 'aa715a39e3126d7cb108c447fb2eb586279fc768', class: "zonos--order-number" }, "Order #", orderId)), h("zonos-text", { key: 'ee58b57b784269145d286e59cc87eb4fb5499cf2', textColor: "gray-600" }, this.notificationMessages.map(message => (h(Fragment, null, message, h("br", null))))), h("zonos-button", { key: 'a6781fde72abf7b9939e136aa5fdbbdd513a7cf5', onClick: () => this.closeClickHandler(), size: "md", variant: "primary" }, this.notificationActionText)), isTestMode && cartStore.step === 'finish' && (h("div", { key: '5fd0ea2aa8f48347d027c5c7df1eb892236e7bb0', class: "zonos--finish-button-wrapper" }, h("zonos-button", { key: '7fdfb2af11a60f4b20b3ba083dcca1f0ac90ff56', backgroundColor: "gray-0", buttonColor: "gray-1200", onClick: () => this.closeClickHandler(), size: "lg", variant: "outline" }, "New test cart"), h("zonos-button", { key: 'd627533d236a8d9cdaadce90d550984e25b64554', onClick: () => this.redirectToUrl(`/orders/all`), size: "lg", variant: "primary" }, "View order in Dashboard")))))));
261
+ } }, this.isLoading && (h("div", { key: '8063a0e619af1958afc99e4a9aa8bdfeb3f3f896', class: "loading-wrapper" }, h("zonos-spinner", { key: '28d4219090e3c9cb0c8a48fa369ace28f74aa938' }))), !this.isLoading && (h("div", { key: '094b79103e3a26e57c0d81a1153682649dce693e', class: "zonos--finish-details" }, h("div", { key: 'c3a6fe214d5ac5cd58ec533c75e146e573b5da25', class: "zonos--group" }, this.notificationType === 'success' ? (h("zonos-icon", { "aria-label": "Order success", content: SuccessIcon, iconColor: 'blue-800', size: 50 })) : (h("zonos-icon", { "aria-label": "Order failed", content: RemoveIcon, iconColor: 'red-800', size: 50 })), h("zonos-text", { key: 'c9e1b5c7ed5be8b6adbd00e5b3896e023271976e', class: "zonos--title", type: "semiBoldSubheader" }, this.notificationTitle), orderId && (h("div", { key: '8f32ef78f8e584e43988a12bc94f0d52c0348eba', class: "zonos--order-number" }, "Order #", orderId)), h("zonos-text", { key: 'b9aebf9fdfc17d141367deb110440272fed7a6d9', textColor: "gray-600" }, this.notificationMessages.map(message => (h(Fragment, null, message, h("br", null))))), h("zonos-button", { key: '25fb15e1e2fb08e2911c787060215f8e1d7c33c6', onClick: () => this.closeClickHandler(), size: "md", variant: "primary" }, this.notificationActionText)), isTestMode && cartStore.step === 'finish' && (h("div", { key: 'd39ae7b5a0889278e0f6a3594ad69dfa0de2159a', class: "zonos--finish-button-wrapper" }, h("zonos-button", { key: '09e0dfa830577c1eec035f34342528a73bffe944', backgroundColor: "gray-0", buttonColor: "gray-1200", onClick: () => this.closeClickHandler(), size: "lg", variant: "outline" }, "New test cart"), h("zonos-button", { key: 'eedb6a440713fe5f14a05a747284a2703af1a639', onClick: () => this.redirectToUrl(`/orders/all`), size: "lg", variant: "primary" }, "View order in Dashboard")))))));
259
262
  }
260
263
  static get is() { return "zonos-checkout-finish"; }
261
264
  static get encapsulation() { return "shadow"; }